/**
 * 
 */
package dk.itu.mobile;

import java.util.Date;

import dk.itu.mobile.util.TaskListSerializer;
import dk.itu.mobile.vo.Task;
import dk.itu.mobile.vo.TaskList;
import dk.itu.mobile.vo.User;

/**
 * @author niebje
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		TaskList tasklist = new TaskList();
		tasklist.users.add(new User("Niels Bjerg", "password"));
		tasklist.users.add(new User("Peter Tolstrup", "password"));
		tasklist.tasks.add(new Task("test1", "id-1", new Date(), "a test task",tasklist.users));
		
		//prints the list
		System.out.println("printing demo class: \r");
		System.out.println(TaskListSerializer.marshall(tasklist));
		System.out.println("\rend of demo class.");
		
		//load a list
		String path ="C:\\Workspaces\\Eclipse\\ITU\\TaskManager_Niels\\src\\dk\\itu\\mobile\\resources\\task-manager-xml.xml";
		TaskList tl = TaskListSerializer.load(path, TaskList.class);
		System.out.println("Print loaded list:\r");
		System.out.println(TaskListSerializer.marshall(tl));
		System.out.println("End of loaded class print\r");
		
		//save a list
		System.out.println("Save list to desk:\r");
		String path1 ="C:\\Workspaces\\Eclipse\\ITU\\TaskManager_Niels\\src\\dk\\itu\\mobile\\resources\\task-manager-xml-1.xml";
		TaskListSerializer.save(tl, path1);
		System.out.println("List saved!\r");
		
		//load the saved list from desk
		TaskList t2 = TaskListSerializer.load(path1, TaskList.class);
		System.out.println("Print loaded list, Just saved:\r");
		System.out.println(TaskListSerializer.marshall(t2));
		System.out.println("End of loaded class print\r");
	}

}
